package cn.com.hatech.blog.common.controller;

import cn.com.hatech.blog.common.utils.MapCache;

import javax.servlet.http.HttpServletRequest;

/**
 * @projectName: hatech-blog
 * @package: cn.com.hatech.blog.common.controller
 * @className: BaseController
 * @author: xuruikai
 * @description: 基础控制器
 * @date: 2020/1/11 14:27
 * @version: 1.0
 */
public abstract class BaseController {

    public static String THEME = "themes/default";

    protected MapCache cache = MapCache.single();

    /**
     * 主页的页面主题
     *
     * @param viewName
     * @return
     */
    public String render(String viewName) {
        return THEME + "/" + viewName;
    }

    public BaseController title(HttpServletRequest request, String title) {
        request.setAttribute("title", title);
        return this;
    }

    public String render404() {
        return "comm/error_404";
    }

}
